package my.design.proxy;

/**
 * @author zp
 * @version 1.0
 * @description: 代理增强类
 * 在每个方法中加入日志功能
 * @date 2022/10/16 15:52
 */
public class UserServiceProxy implements UserService {

    private UserServiceImpl userService;

    public void setUserService(UserServiceImpl userService) {
        this.userService = userService;
    }

    @Override
    public void add() {
        log("add");
        userService.add();
    }

    @Override
    public void dele() {
        log("dele");
        userService.dele();
    }

    @Override
    public void update() {
        log("update");
        userService.update();
    }

    @Override
    public void slect() {
        log("slect");
        userService.slect();
    }
    public void log(String msg){
        System.out.println("打印了"+msg+"日志");
    }

}

